From: Dirkjan Ochtman Date: Sat, 31 Mar 2018 20:48:32 +0000 (+0200) Subject: Fix spelling errors in interning module X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~111^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=c036952f28b0e7d01eacaf5970de5a1e7c290e22;p=cargo.git Fix spelling errors in interning module --- diff --git a/src/cargo/core/interning.rs b/src/cargo/core/interning.rs index 395ce43ca..a55e684c9 100644 --- a/src/cargo/core/interning.rs +++ b/src/cargo/core/interning.rs @@ -8,7 +8,7 @@ use std::cmp::Ordering; use std::ops::Deref; use std::hash::{Hash, Hasher}; -pub fn leek(s: String) -> &'static str { +pub fn leak(s: String) -> &'static str { let boxed = s.into_boxed_str(); let ptr = boxed.as_ptr(); let len = boxed.len(); @@ -20,7 +20,7 @@ pub fn leek(s: String) -> &'static str { } lazy_static! { - static ref STRING_CASHE: RwLock> = + static ref STRING_CACHE: RwLock> = RwLock::new(HashSet::new()); } @@ -32,14 +32,14 @@ pub struct InternedString { impl InternedString { pub fn new(str: &str) -> InternedString { - let mut cache = STRING_CASHE.write().unwrap(); + let mut cache = STRING_CACHE.write().unwrap(); if let Some(&s) = cache.get(str) { return InternedString { ptr: s.as_ptr(), len: s.len(), }; } - let s = leek(str.to_string()); + let s = leak(str.to_string()); cache.insert(s); InternedString { ptr: s.as_ptr(),